package Maps 
{
	/**
	 * ...
	 * @author Serg de Adelantado
	 */
	public class MapParser 
	{		
		private var FXML:XML;		
		private var FMapImageURL:String;
		private var FRegions:Vector.<MapRegion>;
		
		public function MapParser() 
		{
			FMapImageURL = new String();
			FRegions = new Vector.<MapRegion>;
		}
		
		public function set XMLData(AData:XML):void 
		{
			FXML = AData;
			FMapImageURL = FXML.Image.@File;
			var vList:XMLList = FXML.Regions.descendants('Region');
			var vRegion:MapRegion;
			for (var i in vList)
			{
				vRegion = new MapRegion();
				vRegion.ID = vList[i].@Id;
				vRegion.Status = vList[i].@Status;
				vRegion.Points = vList[i].@Points;				
				vRegion.Price = vList[i].@Price;
				vRegion.PriceCredit = vList[i].@Credit;
				vRegion.Size = vList[i].@Size;
				FRegions.push(vRegion);
			}			
		}
		
		public function get MapImageURL():String
		{ 
			return FMapImageURL;
		}
		
		public function get Regions():Vector.<MapRegion>
		{ 
			return FRegions;
		}
	}
}